package face.pay.api.withdraw.service.impl;

import face.pay.api.withdraw.service.IWithdrawPushService;
import face.pay.util.HttpsUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
@Slf4j
public class WithdrawPushService implements IWithdrawPushService {

    /**
     * 推送到提现服务器
     *
     * @param map
     * @return
     */
    @Override
    public Map pushOrder(Map map) {
        String url = (String) map.get("url");
        String transData = (String) map.get("transData");
        log.info("接受到代付参数url:{} transData:{}",url,transData);
        HashMap<String, String> param = new HashMap<>();
        param.put("transData",transData);
        log.info("开始推送到代付服务器>>>>>>>:{}",transData);
        String result = HttpsUtil.doPost(url, param, null);
        log.info("接受到代付服务器响应<<<<<<<:{}",result);
        HashMap<String, String> result_map = new HashMap<>();
        result_map.put("result",result);
        return result_map;
    }
}
